import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberUserWalletVO, MemberUserWalletForm, MemberUserWalletQuery } from '@/api/member/memberUserWallet/types';

/**
 * 查询用户钱包列表
 * @param query
 * @returns {*}
 */

export const listMemberUserWallet = (query?: MemberUserWalletQuery): AxiosPromise<MemberUserWalletVO[]> => {
  return request({
    url: '/member/memberUserWallet/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户钱包详细
 * @param walletId
 */
export const getMemberUserWallet = (walletId: string | number): AxiosPromise<MemberUserWalletVO> => {
  return request({
    url: '/member/memberUserWallet/' + walletId,
    method: 'get'
  });
};

/**
 * 新增用户钱包
 * @param data
 */
export const addMemberUserWallet = (data: MemberUserWalletForm) => {
  return request({
    url: '/member/memberUserWallet',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户钱包
 * @param data
 */
export const updateMemberUserWallet = (data: MemberUserWalletForm) => {
  return request({
    url: '/member/memberUserWallet',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户钱包
 * @param walletId
 */
export const delMemberUserWallet = (walletId: string | number | Array<string | number>) => {
  return request({
    url: '/member/memberUserWallet/' + walletId,
    method: 'delete'
  });
};
